<?php 
	require_once("includes/constants.php");
	require_once("includes/database.php");
	require_once("includes/common.php");
	require_once("includes/template.php"); 
	head("View Garments");
	if (!isset($_SESSION[GARMENTS])) getAllGarments2(); //for the first time
?>
<?php if (!isset($_SESSION[GARMENTS])) { ?>
	There are no garments registered.
<?php } else { ?>
<table cellspacing="5px"  width="100%">	
	<tr>
		<td>
			&nbsp;
		</td>
		<td class="button1">
			MTM ID
		</td>		
		<td class="button1">
			Title
		</td>
		<td class="button1">
			First Name
		</td>
		<td class="button1">
			Surname
		</td>			
	</tr>
	<?php 
		$count = count($_SESSION[GARMENTS]);
	 	foreach ($_SESSION[GARMENTS] as $index =>$garment) {
	?>
	<input type="hidden" name="garmentCount" id="garmentCount" value=<?php echo $count; ?> />
	<tr>
		<td align="right">
			<input type=radio id="selectedGarment<?php echo $index; ?>" name="selectedGarment" value="<?php echo $index;?>" /> 
		</td>
		<td class="button2">
			<?php echo $_SESSION[GARMENTS][$index]['e_garment_id']; ?>
		</td>		
		<td class="button2">
			<?php echo $_SESSION[GARMENTS][$index]['e_title']; ?>
		</td>
		<td class="button2">
			<?php echo $_SESSION[GARMENTS][$index]['e_firstname']; ?>
		</td>
		<td class="button2">
			<?php echo $_SESSION[GARMENTS][$index]['e_surname']; ?>
		</td>
	</tr>	
	<?php 	
		}
	?>
</table>
<?php } ?>
<?php foot("VIEW","manageGarment.php?" .  "operation=view","UPDATE", "manageGarment.php?"  . "operation=update", "DELETE", "deleteGarment.php "  ); ?>


